package com.ktjy3.test;

import com.ktjy3.entity.SysUser;
import com.ktjy3.service.SysUserService;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * @author 黄军艳
 * @version 1.0
 * @date 2024/12/9  10:01
 */
public class Main {
    Logger logger= LoggerFactory.getLogger(Main.class);
    @Test
    public void test() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SysUserService sysUserService = (SysUserService) context.getBean("sysUserService");
        SysUser sysUser=new SysUser();
        sysUser.setRealName("李");
        sysUser.setRoleId(3l);
        List<SysUser> userList=sysUserService.getSysUserList(sysUser);
        for(SysUser sysUser1:userList){
            logger.info("SysUser: account={}, realName={}, roleName={}",
                    sysUser1.getAccount(), sysUser1.getRealName(),
                    sysUser1.getSysRole().getRoleName());
        }
    }
}
